import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { DefaultComponent } from '../layout/default/default.component';
import { LoginComponent } from '../login/login.component';
import { HomeComponent } from './home/home.component';

const routes: Routes = [
  /** 默认布局 */
  {
    path: 'default',
    component: DefaultComponent,
    children: [
      { path: '', redirectTo: 'home', pathMatch: 'full' }, // full:与指定路径完全一样
      { path: 'home', component: HomeComponent },
      // angular7 懒加载写法
      // {
      //   path: 'playersData',
      //   loadChildren: './count/playersData/playersDate.module#PlayersModule'
      // },
      // angular8 懒加载写法
      {
        path: 'playersData',
        loadChildren: () =>
          import('./count/playersData/playersDate.module').then(
            m => m.PlayersModule
          )
      },
      {
        path: 'loseAnalysis',
        loadChildren: () =>
          import('./count/loseAnalysis/lose-analysis.module').then(
            m => m.LoseAnalysisModule
          )
      },
      {
        path: 'playerManage',
        loadChildren: () =>
          import('./gm-tool/playerManage/player-manage.module').then(
            m => m.PlayerManageModule
          )
      }
    ]
  },
  /** 登陆布局 */
  {
    path: 'login',
    component: LoginComponent
  },
  {
    path: '**',
    component: LoginComponent
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class RouteRoutingModule {}
